#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include <map>

using namespace std;

void print_median(map<int, int>& small, map<int, int>& big, int small_count, int big_count)
{
    if(big_count + small_count == 0)
    {
        cout << "Wrong!\n";
        return;
    }
    if(big_count == small_count)
    {
        long long sum = (long long)small.rbegin()->first + (long long)big.begin()->first;
        if(sum == (-1))
            cout << "-0.5\n";
        else if(sum % 2 == 0)
            cout << sum / 2 << "\n";
        else
            cout << sum / 2 << ".5" << "\n";
    }
    else if(small_count < big_count)
    {
        cout << big.begin()->first << "\n";
    }
    else
    {
        cout << small.rbegin()->first << "\n";
    }
}



void move_element(map<int, int>& small, map<int, int>& big, int& small_count, int& big_count, bool direct)
{
    if(direct)
    {
        map<int, int>::reverse_iterator it = small.rbegin();
        if(it->second > 1)
        {
            big[it->first]++;
            it->second--;
        }
        else
        {
            big[it->first]++;
            small.erase(small.find(it->first));
        }
        small_count--;
        big_count++;
    }
    else
    {
        map<int, int>::iterator it = big.begin();
        if(it->second > 1)
        {
            small[it->first]++;
            it->second--;
        }
        else
        {
            small[it->first]++;
            big.erase(it);
        }
        small_count++;
        big_count--;
    }
}


void insert_item(map<int, int>& small, map<int, int>& big, int& small_count, int& big_count, int target)
{
    if(small_count > big_count)
    {
        small[target]++;
        small_count++;
        move_element(small, big, small_count, big_count, true);
    }
    else
    {
        big[target]++;
        big_count++;
        move_element(small, big, small_count, big_count, false);
    }
}

void delete_item(map<int, int>& small, map<int, int>& big, int& small_count, int& big_count, int num)
{
    map<int,int>::iterator it_big = big.find(num);
    map<int,int>::iterator it_small = small.find(num);
    if(it_big != big.end())
    {
        if(it_big->second > 1)
            it_big->second--;
        else
            big.erase(it_big);

        big_count--;
    }
    else if(it_small != small.end())
    {
        if(it_small->second > 1)
            it_small->second--;
        else
            small.erase(it_small);

        small_count--;
    }
    else
    {
        cout << "Wrong!\n";
        return;
    }
    if(small_count + 1 < big_count) move_element(small, big, small_count, big_count, false);
    if(small_count > 1 + big_count) move_element(small, big, small_count, big_count, true);

    print_median(small, big, small_count, big_count);
}



void run(istream& is)
{
    int numTests;
    is >> numTests;
    map<int, int> small;
    map<int, int> big;
    int small_count = 0;
    int big_count = 0;
    for(int i = 0; i < numTests; i++)
    {
        char action;
        int num;
        is >> action;
        is >> num;
        if(action == 'a')
        {
            insert_item(small, big, small_count, big_count, num);
            print_median(small, big, small_count, big_count);
        }
        else 
        {
            delete_item(small, big, small_count, big_count, num);
        }
    }
}

int main(int argc, const char * argv[])
{
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);

    // ifstream ifs("input.txt");
    run(cin);
    return 0;
}

